package com.ktjy.web.servlet;

import com.alibaba.fastjson.JSON;
import com.ktjy.web.entity.AjaxResult;
import com.ktjy.web.entity.AttrItem;
import com.ktjy.web.service.AttrService;
import com.ktjy.web.service.impl.AttrServiceImpl;
import com.ktjy.web.util.BaseSevlet;
import com.ktjy.web.util.R;
import my.framework.anno.RequestMapping;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

//@WebServlet(name = "AttrServlet", urlPatterns = "/api/AttrServlet")
public class AttrServlet extends BaseSevlet {

    @RequestMapping("/AttrItem")
    public Object Att(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        AttrService tmp = new AttrServiceImpl();

        List<AttrItem> data=tmp.selelctAll();

        return AjaxResult.success("查询成功",data);
    }
}
